package com.example.demo.jucConcurrent.LockSupport详解;

import java.util.concurrent.locks.LockSupport;

public class demo_02 {
    public static void main(String[] args) {

    }
}
class Mythread extends  Thread{
    private  Object object;

    public  Mythread(Object object){
        this.object = object;
    }

    @Override
    public void run() {

        System.out.println("before unpark");
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        //获取blocker
        System.out.println("blocker info"+ LockSupport.getBlocker((Thread) object));
        //释放许可
        LockSupport.unpark((Thread)object);
        //休眠500ms,保证先执行park中的SetBlock
    }
}
